% Copyright (c) 2016-2021 Morwenn
% SPDX-License-Identifier: MIT

\documentclass{standalone}
\usepackage{tikz}
\usepackage[trim]{tokenizer} 

\input{sorting-network}

\begin{document}

\begin{sortingnetwork}{29}{57}{1}
\nodeconnection{{0, 1},{2, 3},{4, 5},{6, 7},{8, 9},{10, 11},{12, 13},{14, 15},{17, 23},{25, 27}}
\nodeconnection{{0, 2},{4, 6},{8, 10},{12, 14},{19, 20},{21, 24}}
\nodeconnection{{1, 3},{5, 7},{9, 11},{13, 15},{16, 28}}
\nodeconnection{{0, 4},{8, 12},{18, 22}}
\nodeconnection{{1, 5},{9, 13},{16, 17},{18, 19},{20, 22},{24, 27}}
\nodeconnection{{2, 6},{10, 14},{23, 28}}
\nodeconnection{{3, 7},{11, 15},{21, 25}}
\nodeconnection{{0, 8},{16, 18},{19, 23},{26, 27}}
\nodeconnection{{1, 9},{17, 20},{22, 28}}
\nodeconnection{{2, 10},{23, 24},{27, 28}}
\nodeconnection{{3, 11},{20, 25}}
\nodeconnection{{4, 12},{22, 26}}
\nodeconnection{{5, 13},{19, 20},{21, 22},{24, 25},{26, 27}}
\nodeconnection{{6, 14},{17, 23}}
\nodeconnection{{7, 15},{18, 22},{25, 27}}
\nodeconnection{{5, 10},{17, 19},{20, 23},{24, 26}}
\nodeconnection{{6, 9},{16, 21}}
\nodeconnection{{3, 12},{13, 14},{1, 2},{18, 21},{22, 24},{25, 26}}
\nodeconnection{{7, 11},{17, 18},{19, 21},{23, 24}}
\nodeconnection{{4, 8},{20, 22}}
\nodeconnection{{1, 4},{7, 13},{18, 19},{20, 21},{22, 23},{24, 25}}
\nodeconnection{{2, 8},{11, 14},{19, 20},{21, 22}}
\nodeconnection{{2, 4},{5, 6},{9, 10},{11, 13}}
\nodeconnection{{3, 8}}
\nodeconnection{{7, 12}}
\nodeconnection{{6, 8},{10, 12}}
\nodeconnection{{3, 5},{7, 9}}
\nodeconnection{{3, 4},{5, 6},{7, 8},{9, 10},{11, 12}}
\nodeconnection{{6, 7},{8, 9}}

\nodeconnection{{0, 16}}
\nodeconnection{{8, 24}}
\nodeconnection{{8, 16}}
\nodeconnection{{4, 20}}
\nodeconnection{{12, 28}}
\nodeconnection{{12, 20}}
\nodeconnection{{4, 8},{12, 16},{20, 24}}
\nodeconnection{{2, 18}}
\nodeconnection{{10, 26}}
\nodeconnection{{10, 18}}
\nodeconnection{{6, 22}}
\nodeconnection{{14, 22}}
\nodeconnection{{6, 10},{14, 18},{22, 26}}
\nodeconnection{{2, 4},{6, 8},{10, 12},{14, 16},{18, 20},{22, 24},{26, 28}}
\nodeconnection{{1, 17}}
\nodeconnection{{9, 25}}
\nodeconnection{{9, 17}}
\nodeconnection{{5, 21}}
\nodeconnection{{13, 21}}
\nodeconnection{{5, 9},{13, 17},{21, 25}}
\nodeconnection{{3, 19}}
\nodeconnection{{11, 27}}
\nodeconnection{{11, 19}}
\nodeconnection{{7, 23}}
\nodeconnection{{15, 23}}
\nodeconnection{{7, 11},{15, 19},{23, 27}}
\nodeconnection{{3, 5},{7, 9},{11, 13},{15, 17},{19, 21},{23, 25}}
\nodeconnection{{1, 2},{3, 4},{5, 6},{7, 8},{9, 10},{11, 12},{13, 14},{15, 16},{17, 18},{19, 20},{21, 22},{23, 24},{25, 26},{27, 28}}
\end{sortingnetwork}

\end{document}
